package com.maxd.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 活动信息表
 */
@ApiModel("活动信息表")
@Entity
@Getter
@Setter
@Table(name = "rw_activity")
@DynamicInsert
public class RwActivity implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 自增主键
     */
    @ApiModelProperty("自增主键")
    @Id
    @Column(name = "id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 活动名称
     */
    @ApiModelProperty("活动名称")
    @Column(name = "name", nullable = false)
    @NotBlank(message = "活动名称不能为空")
    private String name;

    /**
     * 活动简介
     */
    @ApiModelProperty("活动简介")
    @Column(name = "description")
    private String description;

    /**
     * 活动地点
     */
    @ApiModelProperty("活动地点")
    @Column(name = "activity_address", nullable = false)
    @NotBlank(message = "活动地点不能为空")
    private String activityAddress;

    /**
     * 活动类型
     */
    @ApiModelProperty("活动类型 SQ-社区活动 HW-户外活动")
    @Column(name = "activity_type", nullable = false)
    @NotBlank(message = "活动类型不能为空")
    @Pattern(regexp = "SQ|HW", message = "活动类型输入不正确")
    private String activityType;

    /**
     * 封面图
     */
    @ApiModelProperty("封面图")
    @Column(name = "cover_img", nullable = false)
    @NotBlank(message = "封面图不能为空")
    private String coverImg;

    /**
     * 价格
     */
    @ApiModelProperty("价格")
    @Column(name = "price")
    @NotNull(message = "价格不能为空")
    private BigDecimal price;

    /**
     * 活动人数
     */
    @ApiModelProperty("活动人数")
    @Column(name = "total_members", nullable = false)
    @NotNull(message = "活动人数不能为空")
    private Integer totalMembers;

    /**
     * 参加人数
     */
    @ApiModelProperty("参加人数")
    @Column(name = "join_members", nullable = false)
    private Integer joinMembers;

    /**
     * 活动开始时间
     */
    @ApiModelProperty("活动开始时间")
    @Column(name = "start_time", nullable = false)
    private Date startTime;

    /**
     * 活动结束时间
     */
    @ApiModelProperty("活动结束时间")
    @Column(name = "end_time", nullable = false)
    private Date endTime;

    /**
     * 联系人姓名
     */
    @ApiModelProperty("联系人姓名")
    @Column(name = "contact_name")
    private String contactName;

    /**
     * 联系人电话
     */
    @ApiModelProperty("联系人电话")
    @Column(name = "contact_phone")
    private String contactPhone;

    /**
     * 活动详情，支持富文本
     */
    @ApiModelProperty("活动详情，支持富文本")
    @Column(name = "activity_detail")
    private String activityDetail;

    /**
     * 创建时间
     */
    @ApiModelProperty("创建时间")
    @Column(name = "create_time", nullable = false)
    private Date createTime;

    /**
     * 更新时间
     */
    @ApiModelProperty("更新时间")
    @Column(name = "update_time", nullable = false)
    private Date updateTime;

    /**
     * 创建人
     */
    @ApiModelProperty("创建人")
    @Column(name = "create_by")
    private String createBy;

    /**
     * 更新人
     */
    @ApiModelProperty("更新人")
    @Column(name = "update_by")
    private String updateBy;

}
